<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class TableCreateProductImages extends AbstractMigration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change(): void
    {
        // create the table
        $table  =  $this->table('ctmon_product_images',array('id'=>false,'primary_key'=>['id'],'engine'=>'InnoDB','signed'=>false,'collation'=>'utf8mb4_general_ci','comment'=>'用户表||'));
        $table->addColumn('id','biginteger',array('limit' => 20,'signed'=>false,'identity'=>true,'null'=>false,'comment' => '自增id'))
            ->addColumn('name', 'string',array('limit'  =>  255,'null'=>false,'default'=>'','comment'=>'图片名称'))
            ->addColumn('file_path', 'string',array('limit'  =>  255,'null'=>false,'default'=>'','comment'=>'文件路径'))
            ->addColumn('oss_path', 'string',array('limit'  =>  255,'null'=>true,'default'=>'','comment'=>'oss路径'))
            ->addColumn('cos_path', 'string',array('limit'  =>  255,'null'=>true,'default'=>'','comment'=>'cos路径'))
            ->addColumn('ver','biginteger',array('limit' => 20,'signed'=>false,'null'=>false,'default' =>0,'comment' => '版本检查'))
            ->addColumn('create_time', 'integer',array('limit'  =>  10,'null'=>false,'signed'=>false,'default'=>0,'comment'=>'创建时间'))
            ->addColumn('update_time', 'integer',array('limit'  =>  10,'null'=>false,'signed'=>false,'default'=>0,'comment'=>'修改时间'))
            ->addColumn('delete_time', 'integer',array('limit'  =>  10,'null'=>false,'signed'=>false,'default'=>0,'comment'=>'删除时间'))
            ->create();
    }
}
